#include<stdio.h>
int main()
{
    int n, i, t;
    n = 0;
    for (i = 1; i <= 2019; i++)
    {
        t = i;
        while (t > 0)
        {
            if (t % 10 == 9)
            {
                n++; break;
            }
            else
                t = t / 10;
        }
    }
    printf("%d", n);
    return 0;
}